<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

    <!-- 3、求出1000-9999之间的 4 叶玫瑰数 -->

    <!-- 例如：1634 == 1 * 1 * 1 * 1  +  6 * 6 * 6 * 6  + 3 * 3 * 3 * 3  + 4 * 4 * 4 * 4  -->

    <script>
        
        for(var num=1000;num<=9999;num++){
            
            var qian=parseInt(num/1000);
            var bai=parseInt(num%1000/100);
            var shi=parseInt(num%100/10);
            var ge=parseInt(num%10)
            if(num==(qian*qian*qian*qian+bai*bai*bai*bai+shi*shi*shi*shi+ge*ge*ge*ge)){
                console.log(num);
            }
        }
    </script>

</body>
</html>